<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.7"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>qLibc: What&#39;s qLibc?  &lt;a href=&quot;https://github.com/wolkykim/qlibc/actions&quot; &gt;&lt;img src=&quot;https://github.com/wolkykim/qlibc/workflows/CI/badge.svg&quot; alt=&quot;Actions Status&quot;/&gt;&lt;/a&gt;</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">qLibc
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.7 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('index.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<div><div class="header">
  <div class="headertitle"><div class="title">What's qLibc? <a href="https://github.com/wolkykim/qlibc/actions"><img src="https://github.com/wolkykim/qlibc/workflows/CI/badge.svg" alt="Actions Status" style="pointer-events: none;" class="inline"/></a> </div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><a class="anchor" id="md__2Users_2wolkykim_2github_2qlibc_2README"></a></p>
<p>qLibc is currently one of the most functionally-complete, publicly-licensed C/C++ libraries. The goal of the qLibc project is to provide a <b>simple and powerful general purpose C/C++ library</b> that includes all kinds of containers and general library routines. It provides a ready-made set of common container APIs with a consistent API look.</p>
<h1><a class="anchor" id="autotoc_md0"></a>
qLibc Copyright</h1>
<p>qLibc is published under 2-clause BSD license known as Simplified BSD License. Please refer the LICENSE document included in the package for more details.</p>
<h1><a class="anchor" id="autotoc_md1"></a>
API Reference</h1>
<ul>
<li><a href="https://wolkykim.github.io/qlibc/doc/html/files.html">qlibc Core API Reference</a><ul>
<li>Containers for Key/Value pairs<ul>
<li>Tree Table &mdash; in binary tree(left-leaning red-black tree) data structure.</li>
<li>Hash Table &mdash; in hash-based data structure.</li>
<li>Static Hash Table &mdash; in fixed size memory(array/mmapped/shared).</li>
<li>List Table &mdash; in (doubly) linked-list data structure.</li>
</ul>
</li>
<li>Containers for Objects<ul>
<li>List &mdash; Doubly Linked List.</li>
<li>Vector &mdash; implements a growable array of elements.</li>
<li>Queue &mdash; FIFO(First In First Out) implementation.</li>
<li>Stack &mdash; LIFO(Last In First Out) implementation.</li>
</ul>
</li>
<li>General utilities.<ul>
<li>String &mdash; string trimmer, modifier, replacer, case converter, pattern detectors, ...</li>
<li>I/O &mdash; non-blocking I/O, stream reader/writer, ...</li>
<li>File &mdash; file locking, file/directory hander, path correctors, ...</li>
<li>IPC, Semaphore Shared-memory</li>
<li>En/decoders &mdash; Url en/decoder, Base64 en/decoder, Hex en/decoder, ...</li>
<li>Hashes &mdash; Murmur hases, FNV hases, MD5 hashes, ...</li>
<li>Time &mdash; time diff, time format converstion, ...</li>
</ul>
</li>
</ul>
</li>
<li><a href="https://wolkykim.github.io/qlibc/doc/html/files.html">qLibc Extension API Reference</a><ul>
<li>Apache-style Configuration File Parser.</li>
<li>INI-style Configuration File Parser.</li>
<li>HTTP client.</li>
<li>Rotating File Logger.</li>
<li>Database(MySQL) interface.</li>
<li><a href="https://en.wikipedia.org/wiki/Token_bucket">Token-Bucket</a></li>
</ul>
</li>
</ul>
<h1><a class="anchor" id="autotoc_md2"></a>
qLibc Tables at a Glance</h1>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadLeft">Characteristics   </th><th class="markdownTableHeadCenter">Tree Table   </th><th class="markdownTableHeadCenter">Hash Table   </th><th class="markdownTableHeadCenter">Static Hash Table   </th><th class="markdownTableHeadCenter">List Table    </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Data structure   </td><td class="markdownTableBodyCenter">Binary Tree   </td><td class="markdownTableBodyCenter">Slot Index   </td><td class="markdownTableBodyCenter">Block Array   </td><td class="markdownTableBodyCenter">Linked-List    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft">Search complexity   </td><td class="markdownTableBodyCenter">O(log n)   </td><td class="markdownTableBodyCenter">O(1) / O(n)   </td><td class="markdownTableBodyCenter">O(1) / O(n)   </td><td class="markdownTableBodyCenter">O(n)    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Insert complexity   </td><td class="markdownTableBodyCenter">O(log n)   </td><td class="markdownTableBodyCenter">O(1) / O(n)   </td><td class="markdownTableBodyCenter">O(1) / O(n)   </td><td class="markdownTableBodyCenter">O(1)    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft">Delete complexity   </td><td class="markdownTableBodyCenter">O(log n)   </td><td class="markdownTableBodyCenter">O(1) / O(n)   </td><td class="markdownTableBodyCenter">O(1) / O(n)   </td><td class="markdownTableBodyCenter">O(n)    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Space complexity   </td><td class="markdownTableBodyCenter">O(n)   </td><td class="markdownTableBodyCenter">O(n)   </td><td class="markdownTableBodyCenter">-   </td><td class="markdownTableBodyCenter">O(n)    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft">Space allocation   </td><td class="markdownTableBodyCenter">Dynamic   </td><td class="markdownTableBodyCenter">Dynamic   </td><td class="markdownTableBodyCenter">Pre-allocation   </td><td class="markdownTableBodyCenter">Dynamic    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Key Stored Sorted   </td><td class="markdownTableBodyCenter">Yes   </td><td class="markdownTableBodyCenter">No   </td><td class="markdownTableBodyCenter">No   </td><td class="markdownTableBodyCenter">Yes (option)    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft">User comparator   </td><td class="markdownTableBodyCenter">Supported   </td><td class="markdownTableBodyCenter">-   </td><td class="markdownTableBodyCenter">-   </td><td class="markdownTableBodyCenter">Supported    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Duplicated keys   </td><td class="markdownTableBodyCenter">No   </td><td class="markdownTableBodyCenter">No   </td><td class="markdownTableBodyCenter">No   </td><td class="markdownTableBodyCenter">Yes (option)    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft">Key stored digested   </td><td class="markdownTableBodyCenter">No   </td><td class="markdownTableBodyCenter">No   </td><td class="markdownTableBodyCenter">Yes   </td><td class="markdownTableBodyCenter">No    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Search Nearest Key   </td><td class="markdownTableBodyCenter">Yes   </td><td class="markdownTableBodyCenter">No   </td><td class="markdownTableBodyCenter">No   </td><td class="markdownTableBodyCenter">No    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft">Iterator support   </td><td class="markdownTableBodyCenter">Yes   </td><td class="markdownTableBodyCenter">Yes   </td><td class="markdownTableBodyCenter">Yes   </td><td class="markdownTableBodyCenter">Yes    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Iterator visit order   </td><td class="markdownTableBodyCenter">min -&gt; max   </td><td class="markdownTableBodyCenter">random   </td><td class="markdownTableBodyCenter">random   </td><td class="markdownTableBodyCenter">insert order    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft">Thread-safe option   </td><td class="markdownTableBodyCenter">Supported   </td><td class="markdownTableBodyCenter">Suported   </td><td class="markdownTableBodyCenter">User   </td><td class="markdownTableBodyCenter">Supported    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Can use shared mem   </td><td class="markdownTableBodyCenter">No   </td><td class="markdownTableBodyCenter">No   </td><td class="markdownTableBodyCenter">Yes   </td><td class="markdownTableBodyCenter">No   </td></tr>
</table>
<h1><a class="anchor" id="autotoc_md3"></a>
Consistent API Look</h1>
<p>All container APIs have a consistent look and feel. It basically provides a creator function which usually returns a pointer to a container structure. Also, <b>all functions related to the container can be accessed through function pointers inside of the container</b> or traditional style direct access APIs. For an example,</p>
<p>So, regardless of which container you use, you can simply put elements into a list with <code>container-&gt;put(container, ...)</code> or you can call them using direct API like qtreetbl_pub(container, ...).</p>
<p>An examples below illustrates how it looks like.</p>
<div class="fragment"><div class="line"><span class="comment">// create a hash-table.</span></div>
<div class="line">qhashtbl_t *tbl = <a class="code hl_function" href="qhashtbl_8c.html#a7a2314dcb8381b4599e8050becad2268">qhashtbl</a>(0, QHASHTBL_THREADSAFE);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// add an element which key name is &quot;score&quot;.</span></div>
<div class="line"><span class="keywordtype">int</span> x = 12345;</div>
<div class="line">tbl-&gt;put(tbl, <span class="stringliteral">&quot;score&quot;</span>, &amp;x, <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>));</div>
<div class="line"> </div>
<div class="line"><span class="comment">// get the value of the element.</span></div>
<div class="line"><span class="keywordtype">int</span> *px = tbl-&gt;get(tbl, <span class="stringliteral">&quot;score&quot;</span>, NULL, <span class="keyword">true</span>);</div>
<div class="line"><span class="keywordflow">if</span>(px != NULL) {</div>
<div class="line">  printf(<span class="stringliteral">&quot;%d\n&quot;</span>, *px);</div>
<div class="line">  free(px);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// release table</span></div>
<div class="line">tbl-&gt;free(tbl);</div>
<div class="ttc" id="aqhashtbl_8c_html_a7a2314dcb8381b4599e8050becad2268"><div class="ttname"><a href="qhashtbl_8c.html#a7a2314dcb8381b4599e8050becad2268">qhashtbl</a></div><div class="ttdeci">qhashtbl_t * qhashtbl(size_t range, int options)</div><div class="ttdoc">Initialize hash table.</div><div class="ttdef"><b>Definition</b> <a href="qhashtbl_8c_source.html#l00127">qhashtbl.c:127</a></div></div>
</div><!-- fragment --><p>Here is an identical implementation with a Linked-List-Table container. You may notice that there aren't any code changes at all, except for 1 line in the table creation. This is why qLibc encapsulates corresponding function pointers inside of the container object.</p>
<div class="fragment"><div class="line"><span class="comment">// create a linked-list-table. THE ONLY LINE YOU NEED TO CHANGE.</span></div>
<div class="line">qlisttbl_t *tbl = <a class="code hl_function" href="qlisttbl_8c.html#a0df1c9358a8712794a8a0030a1687f62">qlisttbl</a>(QLISTTBL_THREADSAFE);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// add an element which key name is &quot;score&quot;.</span></div>
<div class="line"><span class="keywordtype">int</span> x = 12345;</div>
<div class="line">tbl-&gt;put(tbl, <span class="stringliteral">&quot;score&quot;</span>, &amp;x, <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>));</div>
<div class="line"> </div>
<div class="line"><span class="comment">// get the value of the element.</span></div>
<div class="line"><span class="keywordtype">int</span> *px = tbl-&gt;get(tbl, <span class="stringliteral">&quot;score&quot;</span>, NULL, <span class="keyword">true</span>);</div>
<div class="line"><span class="keywordflow">if</span>(px != NULL) {</div>
<div class="line">  printf(<span class="stringliteral">&quot;%d\n&quot;</span>, *px);             </div>
<div class="line">  free(px);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// release table</span></div>
<div class="line">tbl-&gt;free(tbl);</div>
<div class="ttc" id="aqlisttbl_8c_html_a0df1c9358a8712794a8a0030a1687f62"><div class="ttname"><a href="qlisttbl_8c.html#a0df1c9358a8712794a8a0030a1687f62">qlisttbl</a></div><div class="ttdeci">qlisttbl_t * qlisttbl(int options)</div><div class="ttdoc">Create a new Q_LIST linked-list container.</div><div class="ttdef"><b>Definition</b> <a href="qlisttbl_8c_source.html#l00150">qlisttbl.c:150</a></div></div>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md4"></a>
Looking for people to work with.</h1>
<p>We're looking for people who want to work together to develop and improve qLibc. Currently, we have high demands on following areas.</p>
<ul>
<li>Automated testing</li>
<li>Documentation.</li>
<li>New feature implementation.</li>
</ul>
<h1><a class="anchor" id="autotoc_md5"></a>
Contributors</h1>
<p>The following people have helped with suggestions, ideas, code or fixing bugs: (in alphabetical order by first name)</p>
<ul>
<li><a href="https://github.com/wolkykim">Seungyoung "Steve" Kim</a> - Project Lead</li>
<li><a href="https://github.com/alexandrelucchesi">Alexandre Lucchesi</a></li>
<li><a href="https://github.com/darkdh">Anthony Tseng</a></li>
<li><a href="https://github.com/kakwa">Carpentier Pierre-Francois</a></li>
<li>Cesar</li>
<li><a href="https://github.com/colintd">Colin</a></li>
<li><a href="https://github.com/Charles0429">Charles</a></li>
<li><a href="https://github.com/demitsuri">Dmitry Vorobiev</a></li>
<li><a href="https://github.com/ffontaine">Fabrice Fontaine</a></li>
<li><a href="https://github.com/Fullaxx">Fullaxx</a></li>
<li>HyoSup Woo</li>
<li><a href="https://github.com/netpoetica">Keith Rosenberg</a></li>
<li>Krishna</li>
<li><a href="https://github.com/haveTryTwo">Liu Zhongchao</a></li>
<li>Luis Jimenez</li>
<li>Maik Beckmann</li>
<li>RQ</li>
<li><a href="https://github.com/kirbyfan64">Ryan Gonzalez</a></li>
<li><a href="https://github.com/strohsnow">Stroh Snow</a></li>
<li>Umesh</li>
</ul>
<p>If we have forgotten or misspelled your name, please let us know. </p>
</div></div><!-- PageDoc -->
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.7 </li>
  </ul>
</div>
</body>
</html>
